package com.company.demo2;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class TestDemo {
    public static void main(String[] args) throws NoSuchFieldException, NoSuchMethodException {
        Class c=Student.class;
        MyAnnotaion m1=(MyAnnotaion) c.getAnnotation(MyAnnotaion.class);
        System.out.println(m1.value()+m1.value2());

        Field f=c.getDeclaredField("name");
        MyAnnotaion m2=(MyAnnotaion)f.getAnnotation(MyAnnotaion.class);
        System.out.println(m2.value()+m2.value2());

        Method m=c.getDeclaredMethod("study",new Class[]{});
        MyAnnotaion m3=(MyAnnotaion)m.getAnnotation(MyAnnotaion.class);
        System.out.println(m3.value()+m3.value2());
    }
}
